home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
basic
/
glib19.zip
/
GLIBDEMO.BAS
< prev
next >
Wrap
BASIC Source File
|
1991-06-27
|
33KB
|
1,231 lines
'
' GLIBDEMO version 3.5
' (C) Copyright 1987-1990, 1991
'
' Demo of some of the newer, more useful or more interesting
' routines from GLIB version 1.9 for QuickBASIC 4.5
'
' Written by Gizmo Mike
'
' NOTE: This should have started from the batch file for proper
' switch settings.
' QB glibdemo /l glib19 /cmd <scrfile> <3 or 4 fake switches>
DECLARE FUNCTION AttrMake% (fg%, bg%)
DECLARE FUNCTION ArgCnt%
DECLARE FUNCTION ArgVar$ (x%)
DECLARE FUNCTION MenuChoice% (menu$(), Trow%, LCol%, NAttr%, Hattr%, title$, Mark%(), XtdChc%)
DECLARE FUNCTION DIR% (mask$, BYVAL FilArryPtr)
DECLARE FUNCTION CPUInfo% (model%, submodel%, BiosRev%, cpu%, ndp%)
DECLARE FUNCTION DayOfYr%
DECLARE FUNCTION DialogBox$ (msg$, prompt$, ok$)
DECLARE FUNCTION ExtMemFree%
DECLARE FUNCTION ExtMemInst%
DECLARE FUNCTION FUnique% (Fil$, attr%, handle%)
DECLARE FUNCTION FClose% (handle%)
DECLARE FUNCTION FCount% (mask$)
DECLARE FUNCTION FReadArray% (SEG arry%, fhandle%, bytes%)
DECLARE FUNCTION FExists% (Fil$)
DECLARE FUNCTION FuncResp% ()
DECLARE FUNCTION GetCh$ (ok$)
DECLARE FUNCTION GetDrv% ()
DECLARE FUNCTION GetCmdStr$
DECLARE FUNCTION GetCmdTLen%
DECLARE FUNCTION GetStack%
DECLARE FUNCTION KeyReady%
DECLARE FUNCTION LCount% (fhandle%, buffer$)
DECLARE FUNCTION MenuCtrl% ()
DECLARE FUNCTION MHz&
DECLARE FUNCTION ParseFileSpec% (raw$, SEG FInfo AS ANY)
DECLARE FUNCTION PrgName$
DECLARE FUNCTION PtrStat% (x%)
DECLARE FUNCTION SysTicks&
DECLARE FUNCTION SubDirGet$
DECLARE FUNCTION VidType% ()
DECLARE FUNCTION VLabelGet$ (drv%)
DECLARE FUNCTION VerifyGet% ()
DECLARE SUB SaveScrn (SEG arry%)
DECLARE SUB RestScrn (SEG arry%)
DECLARE SUB DirF (mask$, SEG FilArryPtr AS ANY)
DECLARE SUB PrintStatL (SEG MsgArray AS ANY, action%, attr%)
CLEAR
DEFINT A-Z
OPTION BASE 1
TYPE structf
drv AS STRING * 2
Path AS STRING * 64
Fil AS STRING * 8
Ext AS STRING * 3
END TYPE
DIM FInfo AS structf ' ParseFIle structure defined
CLS
crt = VidType ' get type of display
IF crt MOD 2 = 0 THEN ' set colors based on CRT Type
fg = 7 ' EGA mono, Mono, or VGA mono
fgh = 15 ' use bland colors
fgw = 0
bgw = 7
NAttr = 112
Rattr = 7
cmode = 0
ELSE
fg = 3 ' CGA, EGA or VGA
fgh = 14 ' use less bland colors
fgw = 14
bgw = 4
NAttr = 78
Rattr = 14
cmode = 1
END IF
COLOR fg, 0
TYPE struct ' type structure for DirF
s AS STRING * 12
END TYPE
TYPE structa
ls AS STRING * 80
END TYPE
REDIM menu$(28) ' string array of demo choices
REDIM Mark(28) ' allow marking of up to 5
REDIM TSqMsg$(4) ' TimeSquare msgs
TSqMsg$(1) = "Press any key to continue"
TSqMsg$(2) = "GLIB: The standard in QB Libraries"
TSqMsg$(3) = "This is a demo of TimeSquare"
TSqMsg$(2) = "GLIB: So much Power, so few $$$"
'set up status line messages
REDIM SLine(2) AS structa
SLine(1).ls = " Navigate with Cursor keys. Select with [Enter] "
SLine(2).ls = " Mark up to 5 selections with [TAB] or [SpaceBar]. [Esc] Quits Demo"
REDIM ScrText((7 * 2000) + 1) ' up to 5 info screens
REDIM ScrnArry(12001) ' enough for 6 screens
REDIM temp(10) ' for printing GLIB returns in a loop
NumArgs = ArgCnt ' call Argument Count function
IF (NumArgs = 0) OR (FExists(Arg$(1)) = 0) THEN
ScrFil$ = "ScrLib19.DAT"
IF FExists(ScrFil$) = 0 THEN
GOSUB HowToRunDemo
SYSTEM
END IF
ELSE
ScrFil$ = ArgVar$(5)
ScrNum = 0 ' screen to load
END IF
' the demo selections
DATA Other InfoSoft Items, Boxes, Chirp, ArgCnt/ArgVar/GetCmdTail, Date / DFRMAT, DIR
DATA DrvSpace, DayOfYr, DialogBox, FExists/FileDNE, FlexMenu, FUnique
DATA GetCH/PGetCh, LCount, MenuCtrl/FuncResp, PrgName/Parse, Printer Routines (4)
DATA Painter, QPrint, Equip Info Routines, "Scrolling (U/D, L/R)"
DATA TFrmat/Systime, Save/Rest Scrn, Windows, VidON / VidOFF
DATA Read / Write Array, Read / Write String, QUIT Demo (or [Esc])
FOR x = 1 TO 28 ' build the main menu
READ menu$(x)
NEXT x
FOR x = 1 TO 3
ScrNum = x ' set screen to load
ScrPOS = ((x - 1) * 2000) + 1 ' array position to load to
GOSUB LoadScrn
NEXT x
FOR x = 1 TO 3
ScrOffs = ((x - 1) * 2000) + 1 ' set offset pointer to array
CALL RestScrn(ScrText(ScrOffs)) ' display screen
x$ = INPUT$(1) ' eat key press
NEXT x
title$ = " GLIB Demo " ' FlexMenu title
First = LBOUND(menu$) ' first possible selection
Last = UBOUND(menu$) ' last (in case somebody messes with it)
DO
CLS
MarkedItem = 0 ' reset flags
ArrayPOS = 0
XtdChc = 5 ' how many marks to allow
REDIM Mark(Last) ' erase old marks
CALL PrintStatL(SLine(1), 0, 112)
item = MenuChoice%(menu$(), -1, -1, NAttr%, Rattr%, title$, Mark%(), XtdChc%)
IF XtdChc <> 27 THEN
FOR i = First TO Last ' check for marked items
IF Mark(i) THEN
item = i
MarkedItem = 1
IF (item < Last + 1) THEN
GOSUB ExecItem
END IF
END IF
NEXT i
IF MarkedItem = 0 THEN
GOSUB ExecItem
END IF
END IF
LOOP UNTIL (XtdChc = 27) OR (item = Last + 1)
' closing sequence
CLS
ScrNum = 1 ' set screen to load
ScrPOS = 1
GOSUB LoadScrn
CALL RestScrn(ScrText(1))
msg$(1) = " Place your GLIB order now! " ' change final msgs
msg$(3) = " Place your GLIB order now! "
LOCATE 24, 3
PRINT SPACE$(60);
CALL TimeSquare(msg$(), 24, 23, NAttr, 0)
LOCATE 24, 3
PRINT SPACE$(60);
LOCATE 23, 1
SYSTEM
ExecItem:
IF item > 20 THEN item = item + 1
CLS
DoFade = 0
ScrNum = item + 3 ' adjust for logo etc
ScrPOS = 1 ' adjust for OTHER INFO
GOSUB LoadScrn
'IF item <> 23 THEN
CALL RestScrn(ScrText(ScrPOS))
'END IF
SELECT CASE item
CASE 0, 1, 11
CASE 2
x$ = INPUT$(1)
GOSUB BoxDemo
CASE 3
GOSUB ChirpDemo
CASE 4
GOSUB CmdLDemo
CASE 5
GOSUB DateStuff
CASE 6
x$ = INPUT$(1)
GOSUB DirDemo
CASE 7
GOSUB DrvSpaceDemo
CASE 8
GOSUB DayYrDemo
CASE 9
x$ = INPUT$(1)
GOSUB DialogBoxDemo
CASE 10
GOSUB ExistDemo
CASE 12
GOSUB UniqDemo
CASE 13
GOSUB GetChDemo
CASE 14
GOSUB LCountDemo
CASE 15
GOSUB MenuCtrlDemo
CASE 16
GOSUB PrgNameDemo
CASE 17
GOSUB PtrDemo
CASE 18
x$ = INPUT$(1)
GOSUB PaintDemo
CASE 19
x$ = INPUT$(1)
GOSUB QPrintDemo
CASE 20
speed = MHz& / 100 ' do test while reading screen
x$ = INPUT$(1)
ScrNum = ScrNum + 1 ' adjust for logo etc
ScrPOS = 2 ' adjust for OTHER INFO
GOSUB LoadScr